package com.lagou.service.impl;

import com.lagou.service.HelloService;
import org.apache.dubbo.config.annotation.Service;
import org.apache.dubbo.rpc.RpcContext;

@Service
public class HelloServiceImpl implements HelloService {

    @Override
    public String methodA(String name, int timeToWait) throws InterruptedException {
        System.out.println("A:hello:"+name);
//        (int) (Math.random() * 100)
        Thread.sleep((int) (Math.random() * 100));
        return "A:hello:"+name;
    }

    @Override
    public String methodB(String name, int timeToWait) throws InterruptedException {
        System.out.println("B:hello:"+name);
        Thread.sleep((int) (Math.random() * 100));
        return "B:hello:"+name;
    }

    @Override
    public String methodC(String name, int timeToWait) throws InterruptedException {
        System.out.println("C:hello:"+name);
        Thread.sleep((int) (Math.random() * 100));
        return "C:hello:"+name;
    }

//    public static void main(String[] args) {
//        for (int i = 0;i<100;i++ ) {
//            System.out.println((int) (Math.random() * 100));
//        }
//    }
}
